package com.jrzh.mvc.search.sys;

import org.apache.commons.lang.StringUtils;

import com.jrzh.framework.base.search.BaseSearch;
import com.jrzh.framework.searchutils.Criteria;
import com.jrzh.framework.searchutils.Restrictions;

public class RoleSearch extends BaseSearch{

	/**
	 * 
	 */
	private static final long serialVersionUID = 3365144315665848354L;
	
	private Object[] inIds;
	
	private String likeCode;
	
	private String likeName;
	
	private Object[] noInIds;
	
	
	public String getLikeCode() {
		return likeCode;
	}

	public void setLikeCode(String likeCode) {
		this.likeCode = likeCode;
	}

	public String getLikeName() {
		return likeName;
	}

	public void setLikeName(String likeName) {
		this.likeName = likeName;
	}


	public Object[] getInIds() {
		return inIds;
	}

	public void setInIds(Object[] inIds) {
		this.inIds = inIds;
	}

	@Override
	public void setCriterias(Criteria<?> criterias) {
		if(StringUtils.isNotBlank(likeCode)){
			criterias.add(Restrictions.like("code", "%" + likeCode + "%"));
		}
		if(StringUtils.isNotBlank(likeName)){
			criterias.add(Restrictions.like("name", "%" + likeName + "%"));
		}
		if(null != inIds && inIds.length > 0){
			criterias.add(Restrictions.in("id", inIds));
		}
		if(null != noInIds&&noInIds.length>0){
			criterias.add(Restrictions.notIn("id", noInIds));
		}
		
	}

	public Object[] getNoInIds() {
		return noInIds;
	}

	public void setNoInIds(Object[] noInIds) {
		this.noInIds = noInIds;
	}
	

}
